<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 判断数据类型
        let isArray = function (obj) {
            return Object.prototype.toString.call(obj) === `[object Array]`
        }
        // 封装一个函数,继续向上封装,能够返回判断不同数据类型的函数
        let isType = function (type) {
            // 封装函数时,如果内层函数,需要参数
            return function (obj) {
                return Object.prototype.toString.call(obj) === `[object ${type}]`
            }
        }
        let isObject = isType('Object')
        console.log(isObject({}));
    </script>
</body>

</html>